#pragma once
#include "Sort.h"

template <class T>
class InsertionSort: public Sort<T>
{
public:
	InsertionSort(void);
	~InsertionSort(void);

	bool MakeStepUpSort(MyArray<T> arr)
	{
		int i,j; 
		T temp;

		for (i = 1; i < arr.Count(); i++) 
		{ 
			temp = arr[i]; 
			for (j = i - 1; j >= 0 && temp < arr[j]; j--) 
				arr[j + 1] = arr[j]; 
			arr[j + 1] = temp;
		}
	};

	bool MakeStepDownSort(MyArray<T> arr)
	{
		int i,j; 
		T temp;

		for (i = 1; i < arr.Count(); i++) 
		{ 
			temp = arr[i];
			for (j = i - 1; j >= 0 && temp > arr[j]; j--) 
				arr[j + 1] = arr[j];
			arr[j + 1] = temp;
		}
	};
};

